<?php

namespace app\api\model;

use think\Model;

/**
 * Advert
 */
class Advert extends Model
{
    // 表名
    protected $name = 'advert';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    public function getAdvert(){
        $list = self::where(['status' => 1])->field('id,title,image,type,editor')->order('weigh desc')->select()->toArray();
        foreach ($list as &$val){
            $val['image'] =env('domain.image_url').$val['image'];
        }
        return api_message($list);
    }
}